package com.dushibao.manage.uploadServer;

import com.dushibao.service.UploadServerService;
import com.dushibao.service.impl.UploadServerServiceImpl;
import com.dushibao.utils.Page;
import com.dushibao.view.ModelAndView;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

@WebServlet("/uploadServer/list")
public class ListServlet extends HttpServlet {
    UploadServerService uploadServerService = new UploadServerServiceImpl();

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        String current = req.getParameter("current");
        String pageSize = req.getParameter("pageSize");
        String name = req.getParameter("name");
        String address = req.getParameter("address");

        Page page = new Page();
        page.setCurrent(Integer.parseInt(current==null?"1":current));
        page.setPageSize(Integer.parseInt(pageSize==null?"10":pageSize));

        Page iPage = uploadServerService.page(page,name,address);
        Map<String,Object> maps = new HashMap<>();
        maps.put("name",name);
        maps.put("address",address);

        maps.put("iPage",iPage);

        ModelAndView mv = new ModelAndView("uploadServer/list",maps);
    }
}
